<template>
  <div v-loading.fullscreen.lock="fullscreenLoading" class="box">
    <el-form ref="ruleForm" :model="ruleForm" label-width="160px" label-position="left" :rules="rules">
      <el-form-item label="用户类型:">
        <el-select v-model="ruleForm.userType" @focus="switchUser" @change="SettlementType">
          <el-option label="企业用户" value="1" />
          <el-option label="个人用户" value="3" />
        </el-select>
      </el-form-item>
      <div v-if="ruleForm.userType === '1'" style="display: flex;">
        <el-form-item label="执照名称:" prop="LicenseName">
          <el-input v-model="ruleForm.LicenseName" placeholder="请输入执照名称" style="width:200px;" />
        </el-form-item>
        <el-form-item label="营业执照:" prop="BusinessLicenseImg" style="margin-left: 100px;">
          <div style="display: flex;align-items: flex-end;">
            <UploadImg v-model="ruleForm.BusinessLicenseImg" @func="getImgY" />
            <!-- <el-upload
              :action="uploadImgApi"
              :show-file-list="false"
              :headers="{ 'X-SERVICER-TOKEN': $store.state.user.token }"
              :before-upload="uploadImgBefore"
              :on-progress="uploadImgProgress"
              :on-error="uploadImgError"
              :on-success="uploadImgSuccess"
              class="upload-box"
            >
              <el-image v-if="form.icon" :src="fileBaseUrl + form.icon" class="upload-img" fit="contain" />
              <i v-else class="el-icon-plus" />
            </el-upload> -->

            <!-- <div style="line-height: normal;margin-left: 20px">
           <div>图片要求：</div>
           <div>1.上传的图片限制文件大小限制1MB，仅支持JPG、PNG格式</div>
           <div>2.建议尺寸： 100*100像素</div>
         </div> -->
          </div>
        </el-form-item>
      </div>
      <div v-if="ruleForm.userType === '1'" style="display: flex;">
        <el-form-item label="联系人姓名:" prop="name">
          <el-input v-model="ruleForm.name" placeholder="请输入联系人姓名" style="width:200px;" />
        </el-form-item>
        <el-form-item label="联系人手机:" style="margin-left: 100px;" prop="contactPhone">
          <el-input v-model="ruleForm.contactPhone" placeholder="请输入联系人手机号" style="width:200px;" />
        </el-form-item>
      </div>
      <div v-if="ruleForm.userType === '1'" style="display: flex;">
        <el-form-item label="法人姓名:" prop="legalName">
          <el-input v-model="ruleForm.legalName" placeholder="请输入法人姓名" style="width:200px;" />
        </el-form-item>
        <el-form-item label="法人证件号码:" style="margin-left: 100px;" prop="legalPhone">
          <el-input v-model="ruleForm.legalPhone" placeholder="请输入法人证件号码" style="width:200px;" />
        </el-form-item>
      </div>

      <el-form-item v-if="ruleForm.userType === '1'" label="法人证件有效期:" prop="certDate">
        <el-input v-model="ruleForm.certDate" placeholder="例:20210131-20310101,长期填88888888" style="width:500px;" />
      </el-form-item>
      <div v-if="ruleForm.userType === '1'" style="display: flex;">
        <el-form-item label="法人身份证正面:" prop="legalPositiveImg">
          <UploadImg v-model="ruleForm.legalPositiveImg" @func="getImgFZ" />
        </el-form-item>
        <el-form-item label="法人身份证反面:" prop="legalBackImg" style="margin-left:200px;">
          <UploadImg v-model="ruleForm.legalBackImg" @func="getImgFF" />
        </el-form-item>
      </div>

      <div v-if="ruleForm.userType === '1'" style="display: flex;">
        <el-form-item label="营业执照编号:" prop="LicenseNum">
          <el-input v-model="ruleForm.LicenseNum" placeholder="请输入营业执照编号" style="width:200px;" />
        </el-form-item>
        <el-form-item label="执照有效期:" style="margin-left: 100px;" prop="LicenseDate">
          <el-input v-model="ruleForm.LicenseDate" placeholder="例:20210131-20310101,长期填88888888" style="width:300px;" />
        </el-form-item>

      </div>
      <el-form-item v-if="ruleForm.userType === '1'" label="执照地址" prop="provinceCodeZ">
        <el-select v-model="ruleForm.provinceCodeZ" :clearable="false" placeholder="请选择省" @change="provinceListZ">
          <el-option v-for="item in provinceArrZ" :key="item.code" :label="item.message" :value="item.code" />
        </el-select>
        <el-select
          v-if="CityCodeShowZ"
          v-model="ruleForm.CityCodeZ"
          :clearable="false"
          placeholder="请选择市"
          style="margin-left: 10px;"
          @change="CityListZ"
        >
          <el-option v-for="item in CityArrZ" :key="item.code" :label="item.message" :value="item.code" />
        </el-select>
        <el-select
          v-if="AreasCodeShowZ"
          v-model="ruleForm.AreasCodeZ"
          :clearable="false"
          placeholder="请选择区"
          style="margin-left: 10px;"
          @change="AreasListZ"
        >
          <el-option v-for="item in AreasArrZ" :key="item.code" :label="item.message" :value="item.code" />
        </el-select>
      </el-form-item>
      <el-form-item label="详细地址" prop="DetailedAddress">
        <el-input v-model="ruleForm.DetailedAddress" type="textarea" maxlength="100" show-word-limit />
      </el-form-item>
      <div style="display: flex;">
        <el-form-item v-if="ruleForm.userType === '1'" label="结算类型:">
          <el-select v-model="ruleForm.settType" placeholder="请选择结算类型">
            <el-option label="法人对公" value="DG" />
            <el-option label="法人对私" value="DS" />
            <el-option label="非法人对私" value="FDS" />
          </el-select>
        </el-form-item>
        <el-form-item v-else label="结算类型:">
          <el-select v-model="ruleForm.settType" placeholder="请选择结算类型">
            <el-option label="法人对私" value="DS" />
          </el-select>
        </el-form-item>
        <el-form-item label="结算周期:" style="margin-left: 100px;">
          <span>{{ ruleForm.settCycle }}</span>
        </el-form-item>
      </div>
      <div
        v-if="ruleForm.userType === '1' && ruleForm.settType === 'FDS'"
        style="display: flex;"
      >
        <el-form-item label="结算户身份证正面:" prop="settPositiveImg">
          <UploadImg v-model="ruleForm.settPositiveImg" @func="getImgJZ" />
        </el-form-item>
        <el-form-item label="结算户身份证反面:" prop="settBackImg" style="margin-left:200px;">
          <UploadImg v-model="ruleForm.settBackImg" @func="getImgJF" />
        </el-form-item>
      </div>
      <div
        v-if="ruleForm.userType === '3' && ruleForm.settType === 'DS' "
        style="display: flex;"
      >
        <el-form-item label="结算户身份证正面:" prop="settPositiveImg">
          <UploadImg v-model="ruleForm.settPositiveImg" @func="getImgJZ" />
        </el-form-item>
        <el-form-item label="结算户身份证反面:" prop="settBackImg" style="margin-left:200px;">
          <UploadImg v-model="ruleForm.settBackImg" @func="getImgJF" />
        </el-form-item>
      </div>
      <div
        v-if="ruleForm.userType === '1' && ruleForm.settType === 'FDS'"
        style="display: flex;"
      >
        <el-form-item label="结算户身份证号:" prop="settIdNum">
          <el-input v-model="ruleForm.settIdNum" placeholder="请输入结算户身份证号" style="width:200px;" />
        </el-form-item>
        <el-form-item label="结算户身份证有效期:" prop="settIdNumDate" style="margin-left: 100px;">
          <el-input
            v-model="ruleForm.settIdNumDate"
            placeholder="例:20210131-20310101,长期填88888888"
            style="width:300px;"
          />
        </el-form-item>
      </div>
      <div
        v-if="ruleForm.userType === '3'&& ruleForm.settType === 'DS'"
        style="display: flex;"
      >
        <el-form-item label="结算户身份证号:" prop="settIdNum">
          <el-input v-model="ruleForm.settIdNum" placeholder="请输入结算户身份证号" style="width:200px;" />
        </el-form-item>
        <el-form-item label="结算户身份证有效期:" prop="settIdNumDate" style="margin-left: 100px;">
          <el-input
            v-model="ruleForm.settIdNumDate"
            placeholder="例:20210131-20310101,长期填88888888"
            style="width:300px;"
          />
        </el-form-item>
      </div>
      <el-form-item v-if="ruleForm.userType === '1' && ruleForm.settType === 'DG'" label="开户许可证:" prop="permitImg">
        <UploadImg v-model="ruleForm.permitImg" @func="getImgYK" />
      </el-form-item>
      <!-- <el-form-item v-if="ruleForm.userType === '3'" label="详细地址" prop="userAddress">
        <el-input v-model="ruleForm.userAddress" type="textarea" maxlength="100" show-word-limit />
      </el-form-item> -->
      <el-form-item
        v-if="ruleForm.userType === '3' || ruleForm.settType === 'FDS' || ruleForm.settType === 'DS'"
        label="银行卡正面:"
        prop="BackFrontImg"
      >
        <UploadImg v-model="ruleForm.BackFrontImg" @func="getImgBank" />
      </el-form-item>
      <div style="display: flex;">
        <el-form-item label="结算账户名:" prop="Settname">
          <el-input v-model="ruleForm.Settname" placeholder="请输入结算账户名" style="width:200px;" />
        </el-form-item>
        <el-form-item label="结算卡号:" prop="SettCardNum" style="margin-left: 100px;">
          <el-input v-model="ruleForm.SettCardNum" placeholder="请输入结算卡号" style="width:200px;" />
        </el-form-item>
      </div>
      <div style="display: flex;">
        <el-form-item label="开户省市:" prop="provinceCode">
          <el-select v-model="ruleForm.provinceCode" :clearable="false" placeholder="请选择省" @change="provinceList">
            <el-option v-for="item in provinceArr" :key="item.code" :label="item.message" :value="item.code" />
          </el-select>
          <el-select
            v-if="CityCodeShow"
            v-model="ruleForm.CityCode"
            :clearable="false"
            placeholder="请选择市"
            style="margin-left: 10px;"
            @change="CityList"
          >
            <el-option v-for="item in CityArr" :key="item.code" :label="item.message" :value="item.code" />
          </el-select>
          <el-select
            v-if="AreasCodeShow"
            v-model="ruleForm.AreasCode"
            :clearable="false"
            placeholder="请选择区"
            style="margin-left: 10px;"
            @change="AreasList"
          >
            <el-option v-for="item in AreasArr" :key="item.code" :label="item.message" :value="item.code" />
          </el-select>
        </el-form-item>

      </div>
      <el-form-item label="开户总行:" prop="HeadOffice">
        <el-select
          v-if="!ifModify"
          v-model="ruleForm.HeadOffice"
          placeholder="请选择开户总行"
          @change="BankList"
          @focus="provinceFocus"
        >
          <el-option
            v-for="item in BankArr"
            :key="item.id"
            :label="item.message"
            :value="item.id"
            @click.native="labelClick(item.message)"
          />
        </el-select>
        <el-select
          v-else
          v-model="ruleForm.HeadOfficeName"
          placeholder="请选择开户总行"
          @change="BankList"
          @focus="provinceFocus"
        >
          <el-option
            v-for="item in BankArr"
            :key="item.id"
            :label="item.message"
            :value="item.id"
            @click.native="labelClick(item.message)"
          />
        </el-select>
      </el-form-item>
      <div style="display: flex;">
        <el-form-item label="支行名称:" prop="SubBranch">
          <el-select
            v-if="!ifModify"
            v-model="ruleForm.SubBranch"
            filterable
            placeholder="请输入支行名称搜索"
            @focus="SubBranchChang"
            @change="SubBranchList"
          >
            <el-option
              v-for="item in SubBranchArr"
              :key="item.id"
              :label="item.message"
              :value="item.id"
              @click.native="SubBranchLabelClick(item.message)"
            />
          </el-select>
          <el-select v-else v-model="ruleForm.SubBranchName" filterable placeholder="请输入支行名称搜索" @change="SubBranchList" @focus="SubBranchChang">
            <el-option
              v-for="item in SubBranchArr"
              :key="item.id"
              :label="item.message"
              :value="item.id"
              @click.native="SubBranchLabelClick(item.message)"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="预留手机:" prop="reservePhone" style="margin-left: 100px;">
          <el-input v-model="ruleForm.reservePhone" placeholder="请输入预留手机号" style="width:200px;" />
        </el-form-item>
      </div>
      <el-form-item v-if="ruleForm.settType === 'FDS'" label="关系证明:" prop="proveImg">
        <!-- <span>下载模板</span> -->
        <a href="./商户关系证明模板.pdf" download="商户关系证明模板" style="color: #0000FF;">下载模板</a>

        <UploadImg v-model="ruleForm.proveImg" @func="getImgGX" />
      </el-form-item>
      <div style="margin-top:50px;margin-left: 30%;margin-bottom:50px;">
        <el-button type="warning" style="margin-right: 100px;" @click="cancel">取消</el-button>
        <el-button type="warning" @click="submit">提交</el-button>
      </div>
    </el-form>
    <!-- 尾巴 -->
  </div>
</template>

<script>
import {
  uploadImgApi
} from '@/api/upload'
import UploadImg from '../../../components/UploadImg/index.vue'
import {
  qryProvinces,
  qryCitys,
  qryAreas,
  qryBankTypes,
  qryBankInfos,
  supplementAdd,
  changeInfo
} from '@/api/supplement'
import {
  detail
} from '@/api/user/auth'
export default {
  components: {
    UploadImg
  },
  data() {
    return {
      fullscreenLoading: false,
      CityCodeShow: false,
      CityCodeShowZ: false,
      AreasCodeShow: false,
      AreasCodeShowZ: false,
      restaurants: [],
      actionUrl: uploadImgApi,
      uploadHeaders: {},
      state: '',
      timeout: '',
      provinceArr: [],
      CityArr: [],
      AreasArr: [],
      BankArr: [],
      provinceArrZ: [],
      CityArrZ: [],
      AreasArrZ: [],
      SubBranchArr: [],
      imageUrl: '',
      icon: '',
      ruleForm: {
        userAddress: '',
        BusinessLicenseImg: '', // 营
        legalPositiveImg: '',
        legalBackImg: '',
        settPositiveImg: '',
        settBackImg: '',
        BackFrontImg: '',
        permitImg: '',
        BusinessLicenseImgS: '', // 营
        legalPositiveImgS: '',
        legalBackImgS: '',
        settPositiveImgS: '',
        settBackImgS: '',
        BackFrontImgS: '',
        permitImgS: '',
        proveImg: '',
        proveImgS: '',
        LicenseName: '',
        icon: null,
        userType: '1',
        settType: '',
        name: '',
        Phone: '',
        contactPhone: '',
        legalName: '',
        legalPhone: '',
        certDate: '',
        LicenseNum: '',
        LicenseDate: '',
        region: '',
        DetailedAddress: '',
        settCycle: 'T1',
        Settname: '',
        SettCardNum: '',
        OpenPc: '',
        HeadOffice: '',
        HeadOfficeName: '',
        SubBranch: '',
        SubBranchName: '',
        reservePhone: '',
        settIdNum: '',
        settIdNumDate: '',
        provinceCode: '',
        CityCode: '',
        AreasCode: '',
        provinceCodeZ: '',
        CityCodeZ: '',
        AreasCodeZ: '',
        LicenseCerBeginDate: '', // 法开
        LicenseCerEndDate: '', // 法结
        licenseBeginDate: '', // 营开
        licenseEndDate: '', // 营结
        stlCerBeginDate: '', // 结开
        stlCerEndDate: '' // 结止
      },
      finalStlType: '', // 最终给后台的结算方式
      ifModify: false,
      rules: {
        LicenseName: [
          { required: true, message: '请输入执照名称', trigger: 'blur' }
        ],
        BusinessLicenseImg: [
          { required: true, message: '请上传营业执照', trigger: 'blur' }
        ],
        name: [
          { required: true, message: '请输入联系人姓名', trigger: 'blur' }
        ],
        contactPhone: [
          { required: true, message: '请输入联系人手机', trigger: 'blur' }
        ],
        legalName: [
          { required: true, message: '请输入法人姓名', trigger: 'blur' }
        ],
        legalPhone: [
          { required: true, message: '请输入法人证件号码', trigger: 'blur' }
        ],
        settIdNum: [
          { required: true, message: '请输入结算户身份证号', trigger: 'blur' }
        ],
        settIdNumDate: [
          { required: true, message: '请输入结算户身份证有效期', trigger: 'blur' }
        ],
        certDate: [
          { required: true, message: '请输入法人证件有效期', trigger: 'blur' }
        ],
        legalPositiveImg: [
          { required: true, message: '请上传法人身份证正面', trigger: 'blur' }
        ],
        legalBackImg: [
          { required: true, message: '请上传法人身份证反面', trigger: 'blur' }
        ],
        LicenseNum: [
          { required: true, message: '请输入营业执照编号', trigger: 'blur' }
        ],
        LicenseDate: [
          { required: true, message: '请输入执照有效期', trigger: 'blur' }
        ],
        provinceCodeZ: [
          { required: true, message: '请选择执照地址', trigger: 'blur' }
        ],
        DetailedAddress: [
          { required: true, message: '请输入详细地址', trigger: 'blur' }
        ],
        BackFrontImg: [
          { required: true, message: '请上传银行卡正面', trigger: 'blur' }
        ],
        Settname: [
          { required: true, message: '请输入结算账户名', trigger: 'blur' }
        ],
        SettCardNum: [
          { required: true, message: '请输入结算卡号', trigger: 'blur' }
        ],
        provinceCode: [
          { required: true, message: '请选择开户省市', trigger: 'blur' }
        ],
        HeadOffice: [
          { required: true, message: '请选择开户总行', trigger: 'blur' }
        ],
        reservePhone: [
          { required: true, message: '请输入预留手机号', trigger: 'blur' }
        ],
        proveImg: [
          { required: true, message: '请上传商户关系证明', trigger: 'blur' }
        ],
        permitImg: [
          { required: true, message: '请上传开户许可证', trigger: 'blur' }
        ],
        settPositiveImg: [
          { required: true, message: '请上传结算户身份证正面', trigger: 'blur' }
        ],
        settBackImg: [
          { required: true, message: '请上传结算户身份证反面', trigger: 'blur' }
        ],
        // userAddress: [
        //   { required: true, message: '请填写详细地址', trigger: 'blur' }
        // ],
        SubBranch: [
          { required: true, message: '请选择开户支行', trigger: 'blur' }
        ]
      }
    }
  },
  watch: {
    // 'ruleForm.userType': {
    //   handler(newName, oldName) {
    //     if(newName)
    //     console.log(newName)
    //     this.ruleForm.settType = ''
    //   },
    //   immediate: true,
    //   deep: true
    // }
  },
  mounted() {
    this.provinceCityChoice()
    this.provinceCityChoiceZ()
    this.getDetaildata()
    // console.log('this.ifModify为true就是修改,否则就是新增', this.ifModify)
    console.log('看看结算类型', this.ruleForm.settType)
  },
  methods: {
    // 结算类型选择
    SettlementType() {
      console.log('变化了')
      this.ruleForm.settType = ''
      // this.ruleForm.userAddress = ''
      // this.ruleForm.DetailedAddress = ''
    },
    // 取消
    cancel() {
      this.$router.push({ name: 'SystemUserSetting' })
    },
    // 渠道补充信息详情
    getDetaildata() {
      this.fullscreenLoading = true
      detail().then(res => {
        this.fullscreenLoading = false
        if (res.succeed) {
          console.log('渠道补充信息详情', res)
          if (res.data === '' || res.data === null) { // 如果没有值就说明是新增

          } else { // 否则就是修改
            this.ifModify = true
            const Echo = res.data
            this.ruleForm.userType = Echo.userType
            this.ruleForm.userType = Echo.userType
            if (Echo.stlType === '1') {
              this.ruleForm.settType = 'DG'
            }
            if (Echo.stlType === '2') {
              this.ruleForm.settType = 'DS'
              console.log('this.ruleForm.settType', this.ruleForm.settType)
            }
            if (Echo.stlType === '3') {
              this.ruleForm.settType = 'FDS'
            }
            this.ruleForm.LicenseName = Echo.licenseName
            if (Echo.licensePath) {
              this.ruleForm.BusinessLicenseImgS = Echo.licensePath
              this.ruleForm.BusinessLicenseImg = this.delectImageFormat(Echo.licensePath)
            }
            this.ruleForm.name = Echo.contactName
            this.ruleForm.contactPhone = Echo.contactPhone
            this.ruleForm.legalName = Echo.corpName
            this.ruleForm.legalPhone = Echo.corpCerNo
            this.ruleForm.settIdNum = Echo.stlCerNo
            if (Echo.stlCerBeginDate) {
              this.ruleForm.stlCerBeginDate = Echo.stlCerBeginDate
              this.ruleForm.stlCerEndDate = Echo.stlCerEndDate
              this.ruleForm.settIdNumDate = this.ruleForm.stlCerBeginDate + '-' + this.ruleForm.stlCerEndDate
            }

            if (Echo.cerBeginDate) {
              this.ruleForm.LicenseCerBeginDate = Echo.cerBeginDate
              this.ruleForm.LicenseCerEndDate = Echo.cerEndDate
              this.ruleForm.certDate = this.ruleForm.LicenseCerBeginDate + '-' + this.ruleForm.LicenseCerEndDate
            }
            if (Echo.cerFrontPath) {
              this.ruleForm.legalPositiveImg = this.delectImageFormat(Echo.cerFrontPath)
              this.ruleForm.legalPositiveImgS = Echo.cerFrontPath
              this.ruleForm.legalBackImg = this.delectImageFormat(Echo.cerBehindPath)
              this.ruleForm.legalBackImgS = Echo.cerBehindPath
            }
            if (Echo.stlCerFrontPath) {
              this.ruleForm.settPositiveImgS = Echo.stlCerFrontPath
              this.ruleForm.settPositiveImg = this.delectImageFormat(Echo.stlCerFrontPath)
              this.ruleForm.settBackImgS = Echo.stlCerBehindPath
              this.ruleForm.settBackImg = this.delectImageFormat(Echo.stlCerBehindPath)
            }

            this.ruleForm.LicenseNum = Echo.licenseNo
            this.ruleForm.licenseBeginDate = Echo.licenseBeginDate
            this.ruleForm.licenseEndDate = Echo.licenseEndDate
            this.ruleForm.LicenseDate = this.ruleForm.licenseBeginDate + '-' + this.ruleForm.licenseEndDate
            this.ruleForm.provinceCodeZ = Echo.licenseProvince

            this.ruleForm.CityCodeZ = Echo.licenseCity
            this.ruleForm.AreasCodeZ = Echo.licenseArea
            if (this.ruleForm.provinceCodeZ) {
              this.CityChoiceZ()
              this.AreasChoiceZ()
              this.CityCodeShowZ = true
              this.AreasCodeShowZ = true
            }
            this.ruleForm.DetailedAddress = Echo.licenseAddr
            if (Echo.cardFrontPath) {
              this.ruleForm.BackFrontImgS = Echo.cardFrontPath
              this.ruleForm.BackFrontImg = this.delectImageFormat(Echo.cardFrontPath)
            }
            if (Echo.openPermitPath) {
              this.ruleForm.permitImgS = Echo.openPermitPath
              this.ruleForm.permitImg = this.delectImageFormat(Echo.openPermitPath)
            }

            this.ruleForm.Settname = Echo.stlAccName
            this.ruleForm.SettCardNum = Echo.stlBankNo
            this.ruleForm.provinceCode = Echo.stlProvince

            this.ruleForm.CityCode = Echo.stlCity
            this.ruleForm.AreasCode = Echo.stlArea
            if (this.ruleForm.provinceCode) {
              this.CityChoice()
              this.AreasChoice()
              this.CityCodeShow = true
              this.AreasCodeShow = true
            }
            this.ruleForm.HeadOffice = Echo.stlBankCode
            this.ruleForm.HeadOfficeName = Echo.stlBankName
            this.ruleForm.SubBranch = Echo.stlSubBankCode
            this.ruleForm.SubBranchName = Echo.stlSubBankName
            this.ruleForm.reservePhone = Echo.stlPhone
            if (Echo.relationPath) {
              this.ruleForm.proveImgS = Echo.relationPath
              this.ruleForm.proveImg = this.delectImageFormat(Echo.relationPath)
            }
            this.ruleForm.DetailedAddress = Echo.userAddress
          }

          // ⬆

          // ⬇
        }
      })
    },
    getImgY(data) {
      console.log('啥', data)
      this.ruleForm.BusinessLicenseImgS = data
    },
    getImgFZ(data) {
      console.log('啥', data)
      this.ruleForm.legalPositiveImgS = data
    },
    getImgFF(data) {
      console.log('啥', data)
      this.ruleForm.legalBackImgS = data
    },
    getImgJZ(data) {
      console.log('啥', data)
      this.ruleForm.settPositiveImgS = data
    },
    getImgJF(data) {
      console.log('啥', data)
      this.ruleForm.settBackImgS = data
    },
    getImgBank(data) {
      console.log('啥', data)
      this.ruleForm.BackFrontImgS = data
    },
    getImgYK(data) {
      console.log('啥', data)
      this.ruleForm.permitImgS = data
    },
    getImgGX(data) {
      console.log('啥', data)
      this.ruleForm.proveImgS = data
    },
    // 取到总行拉贝
    labelClick(data) {
      console.log(data)
      this.ruleForm.HeadOfficeName = data
    },
    // 支行拉贝
    SubBranchLabelClick(data) {
      this.ruleForm.SubBranchName = data
    },
    // 总行触发时
    provinceFocus() {
      console.log('触发')
      this.ruleForm.SubBranchName = ''
      this.ruleForm.SubBranch = ''
      if (this.ruleForm.provinceCode === '') {
        this.$message({
          message: '请先选择省市区!',
          type: 'warning'
        })
      } else {
        this.getBank()
      }
    },
    // 省改变时
    provinceList() {
      console.log('确定省后code', this.ruleForm.provinceCode)
      this.ruleForm.CityCode = ''
      this.ruleForm.AreasCode = ''
      this.ruleForm.SubBranch = ''
      this.ruleForm.SubBranchName = ''
      this.ruleForm.HeadOfficeName = ''
      this.ruleForm.HeadOffice = ''
      // const deputy = this.ruleForm.provinceCode

      // if (deputy === '11' || deputy === '12' || deputy === '31') {
      //   this.CityCodeShow = false
      //   this.AreasCodeShow = false
      // } else {
      //   this.CityChoice()
      //   this.CityCodeShow = true
      // }
      this.CityChoice()
      this.CityCodeShow = true
    },
    // 执照省改变时
    provinceListZ() {
      console.log('省code', this.ruleForm.provinceCodeZ)
      this.ruleForm.CityCodeZ = ''
      this.ruleForm.AreasCodeZ = ''
      // const deputy = this.ruleForm.provinceCodeZ

      // if (deputy === '11' || deputy === '12' || deputy === '31') {
      //   this.CityCodeShowZ = false
      //   this.AreasCodeShowZ = false
      // } else {
      //   this.CityChoiceZ()
      //   this.CityCodeShowZ = true
      // }
      this.CityChoiceZ()
      this.CityCodeShowZ = true
    },
    // 获取省
    provinceCityChoice() {
      qryProvinces().then(res => {
        console.log('获取省', res)
        this.provinceArr = res.data
      })
    },
    // 获取执照省
    provinceCityChoiceZ() {
      qryProvinces().then(res => {
        console.log('获取省', res)
        this.provinceArrZ = res.data
      })
    },
    // 市改变时
    CityList() {
      console.log('市code', this.ruleForm.CityCode)
      this.ruleForm.AreasCode = ''
      this.AreasCodeShow = true
      this.AreasChoice()
    },
    // 执照市改变时
    CityListZ() {
      console.log('市code', this.ruleForm.CityCodeZ)
      this.ruleForm.AreasCodeZ = ''
      this.AreasCodeShowZ = true
      this.AreasChoiceZ()
    },
    // 获取市
    CityChoice() {
      const provinceCode = {
        provinceCode: this.ruleForm.provinceCode
      }
      qryCitys(provinceCode).then(res => {
        console.log('获取市', res)
        this.CityArr = res.data
      })
    },
    // 获取执照市
    CityChoiceZ() {
      const provinceCode = {
        provinceCode: this.ruleForm.provinceCodeZ
      }
      qryCitys(provinceCode).then(res => {
        console.log('获取市', res)
        this.CityArrZ = res.data
      })
    },
    // 获取区
    AreasChoice() {
      const cityCode = {
        cityCode: this.ruleForm.CityCode
      }
      qryAreas(cityCode).then(res => {
        console.log('获取区', res)
        this.AreasArr = res.data
      })
    },
    // 获取执照区
    AreasChoiceZ() {
      const cityCode = {
        cityCode: this.ruleForm.CityCodeZ
      }
      qryAreas(cityCode).then(res => {
        console.log('获取区', res)
        this.AreasArrZ = res.data
      })
    },
    // 选择区
    AreasList() {
      console.log('区code', this.ruleForm.AreasCode)
    },
    // 选择执照区
    AreasListZ() {
      console.log('区code', this.ruleForm.AreasCodeZ)
    },
    // 查询总行
    getBank() {
      qryBankTypes().then(res => {
        if (res.succeed) {
          console.log('查询总行', res)
          this.BankArr = res.data
        }
      })
    },

    // 选择总行后
    BankList(e) {
      // console.log('这是啥', e)
      this.ruleForm.HeadOffice = e
      console.log('总行code', this.ruleForm.HeadOffice)
      this.getSubBranch()
    },
    // 选择支行后
    SubBranchList(e) {
      this.ruleForm.SubBranch = e
      console.log('支行code', this.ruleForm.SubBranch)
    },
    // 触发支行
    SubBranchChang() {
      // console.log('触发支行,看看总行有没有数据', this.ruleForm.HeadOffice)
      if (this.ruleForm.HeadOffice === '') {
        this.$message({
          message: '请先选择总行',
          type: 'warning'
        })
      } else {
        this.getSubBranch()
      }
    },
    // 查询支行
    getSubBranch() {
      const bankId = {
        bankId: this.ruleForm.HeadOffice,
        provinceId: this.ruleForm.provinceCode,
        cityId: this.ruleForm.CityCode
      }
      qryBankInfos(bankId).then(res => {
        console.log('查询支行', res)
        this.SubBranchArr = res.data
      })
    },
    // 提交
    submit() {
      // 校验⬇
      if (this.ruleForm.userType === '1') {
        if (this.ruleForm.settType === 'DG') {
          console.log('企业用户对公校验')
          if (this.ruleForm.LicenseName === '') {
            this.$message.error('执照名称不能为空')
            return
          }
          if (this.ruleForm.BusinessLicenseImg === '') {
            this.$message.error('未上传营业执照')
            return
          }
          if (this.ruleForm.name === '') {
            this.$message.error('联系人姓名不能为空')
            return
          }
          if (this.ruleForm.contactPhone === '') {
            this.$message.error('联系人手机号不能为空')
            return
          }
          if (this.ruleForm.legalName === '') {
            this.$message.error('法人姓名不能为空')
            return
          }
          if (this.ruleForm.legalPhone === '') {
            this.$message.error('法人证件号码不能为空')
            return
          }
          if (this.ruleForm.certDate === '') {
            this.$message.error('法人证件有效期不能为空')
            return
          }
          if (this.ruleForm.legalPositiveImg === '') {
            this.$message.error('法人身份证正面不能为空')
            return
          }
          if (this.ruleForm.legalBackImg === '') {
            this.$message.error('法人身份证反面不能为空')
            return
          }
          if (this.ruleForm.LicenseNum === '') {
            this.$message.error('营业执照编号不能为空')
            return
          }
          if (this.ruleForm.LicenseDate === '') {
            this.$message.error('执照有效期不能为空')
            return
          }
          if (this.ruleForm.provinceCodeZ === '') {
            this.$message.error('执照地址不能为空')
            return
          }
          if (this.ruleForm.DetailedAddress === '') {
            this.$message.error('详细地址不能为空')
            return
          }
          if (this.ruleForm.settType === '') {
            this.$message.error('请选择结算类型')
            return
          }
          if (this.ruleForm.permitImg === '') {
            this.$message.error('开户许可证不能为空')
            return
          }
          if (this.ruleForm.Settname === '') {
            this.$message.error('结算账户名不能为空')
            return
          }
          if (this.ruleForm.SettCardNum === '') {
            this.$message.error('结算卡号不能为空')
            return
          }
          if (this.ruleForm.provinceCode === '') {
            this.$message.error('开户省市不能为空')
            return
          }
          if (this.ruleForm.HeadOffice === '') {
            this.$message.error('开户总行不能为空')
            return
          }
          if (this.ruleForm.SubBranch === '') {
            this.$message.error('请选择支行')
            return
          }
          if (this.ruleForm.reservePhone === '') {
            this.$message.error('预留手机号不能为空')
            return
          }
        } else if (this.ruleForm.settType === 'DS') {
          console.log('企业用户对私校验')
          if (this.ruleForm.LicenseName === '') {
            this.$message.error('执照名称不能为空')
            return
          }
          if (this.ruleForm.BusinessLicenseImg === '') {
            this.$message.error('未上传营业执照')
            return
          }
          if (this.ruleForm.name === '') {
            this.$message.error('联系人姓名不能为空')
            return
          }
          if (this.ruleForm.contactPhone === '') {
            this.$message.error('联系人手机号不能为空')
            return
          }
          if (this.ruleForm.legalName === '') {
            this.$message.error('法人姓名不能为空')
            return
          }
          if (this.ruleForm.legalPhone === '') {
            this.$message.error('法人证件号码不能为空')
            return
          }
          if (this.ruleForm.certDate === '') {
            this.$message.error('法人证件有效期不能为空')
            return
          }
          if (this.ruleForm.legalPositiveImg === '') {
            this.$message.error('法人身份证正面不能为空')
            return
          }
          if (this.ruleForm.legalBackImg === '') {
            this.$message.error('法人身份证反面不能为空')
            return
          }
          if (this.ruleForm.LicenseNum === '') {
            this.$message.error('营业执照编号不能为空')
            return
          }
          if (this.ruleForm.LicenseDate === '') {
            this.$message.error('执照有效期不能为空')
            return
          }
          if (this.ruleForm.provinceCodeZ === '') {
            this.$message.error('执照地址不能为空')
            return
          }
          if (this.ruleForm.DetailedAddress === '') {
            this.$message.error('详细地址不能为空')
            return
          }
          if (this.ruleForm.settType === '') {
            this.$message.error('请选择结算类型')
            return
          }
          if (this.ruleForm.BackFrontImg === '') {
            this.$message.error('银行卡正面不能为空')
            return
          }
          if (this.ruleForm.Settname === '') {
            this.$message.error('结算账户名不能为空')
            return
          }
          if (this.ruleForm.SettCardNum === '') {
            this.$message.error('结算卡号不能为空')
            return
          }
          if (this.ruleForm.provinceCode === '') {
            this.$message.error('开户省市不能为空')
            return
          }
          if (this.ruleForm.HeadOffice === '') {
            this.$message.error('开户总行不能为空')
            return
          }
          if (this.ruleForm.SubBranch === '') {
            this.$message.error('请选择支行')
            return
          }
          if (this.ruleForm.reservePhone === '') {
            this.$message.error('预留手机号不能为空')
            return
          }
        } else {
          console.log('非法人对私校验')
          if (this.ruleForm.LicenseName === '') {
            this.$message.error('执照名称不能为空')
            return
          }
          if (this.ruleForm.BusinessLicenseImg === '') {
            this.$message.error('未上传营业执照')
            return
          }
          if (this.ruleForm.name === '') {
            this.$message.error('联系人姓名不能为空')
            return
          }
          if (this.ruleForm.contactPhone === '') {
            this.$message.error('联系人手机号不能为空')
            return
          }
          if (this.ruleForm.legalName === '') {
            this.$message.error('法人姓名不能为空')
            return
          }
          if (this.ruleForm.legalPhone === '') {
            this.$message.error('法人证件号码不能为空')
            return
          }
          if (this.ruleForm.certDate === '') {
            this.$message.error('法人证件有效期不能为空')
            return
          }
          if (this.ruleForm.legalPositiveImg === '') {
            this.$message.error('法人身份证正面不能为空')
            return
          }
          if (this.ruleForm.legalBackImg === '') {
            this.$message.error('法人身份证反面不能为空')
            return
          }
          if (this.ruleForm.LicenseNum === '') {
            this.$message.error('营业执照编号不能为空')
            return
          }
          if (this.ruleForm.LicenseDate === '') {
            this.$message.error('执照有效期不能为空')
            return
          }
          if (this.ruleForm.provinceCodeZ === '') {
            this.$message.error('执照地址不能为空')
            return
          }
          if (this.ruleForm.DetailedAddress === '') {
            this.$message.error('详细地址不能为空')
            return
          }
          if (this.ruleForm.settType === '') {
            this.$message.error('请选择结算类型')
            return
          }
          if (this.ruleForm.settPositiveImg === '') {
            this.$message.error('结算户身份证正面不能为空')
            return
          }
          if (this.ruleForm.settBackImg === '') {
            this.$message.error('结算户身份证反面不能为空')
            return
          }
          if (this.ruleForm.settIdNum === '') {
            this.$message.error('结算户身份证号不能为空')
            return
          }
          if (this.ruleForm.settIdNumDate === '') {
            this.$message.error('结算户身份证有效期不能为空')
            return
          }
          if (this.ruleForm.BackFrontImg === '') {
            this.$message.error('银行卡正面不能为空')
            return
          }
          if (this.ruleForm.Settname === '') {
            this.$message.error('结算账户名不能为空')
            return
          }
          if (this.ruleForm.SettCardNum === '') {
            this.$message.error('结算卡号不能为空')
            return
          }
          if (this.ruleForm.provinceCode === '') {
            this.$message.error('开户省市不能为空')
            return
          }
          if (this.ruleForm.HeadOffice === '') {
            this.$message.error('开户总行不能为空')
            return
          }
          if (this.ruleForm.reservePhone === '') {
            this.$message.error('预留手机号不能为空')
            return
          }
          if (this.ruleForm.SubBranch === '') {
            this.$message.error('请选择支行')
            return
          }
          if (this.ruleForm.proveImg === '') {
            this.$message.error('商户关系证明不能为空')
            return
          }
        }
      } else {
        console.log('是个人用户')
        if (this.ruleForm.settType === '') {
          this.$message.error('请选择结算类型')
          return
        }
        if (this.ruleForm.settPositiveImg === '') {
          this.$message.error('结算户身份证正面不能为空')
          return
        }
        if (this.ruleForm.settBackImg === '') {
          this.$message.error('结算户身份证反面不能为空')
          return
        }
        if (this.ruleForm.settIdNum === '') {
          this.$message.error('结算户身份证号不能为空')
          return
        }
        if (this.ruleForm.settIdNumDate === '') {
          this.$message.error('结算户身份证有效期不能为空')
          return
        }
        if (this.ruleForm.BackFrontImg === '') {
          this.$message.error('银行卡正面不能为空')
          return
        }
        if (this.ruleForm.Settname === '') {
          this.$message.error('结算账户名不能为空')
          return
        }
        if (this.ruleForm.SettCardNum === '') {
          this.$message.error('结算卡号不能为空')
          return
        }
        if (this.ruleForm.provinceCode === '') {
          this.$message.error('开户省市不能为空')
          return
        }
        if (this.ruleForm.HeadOffice === '') {
          this.$message.error('开户总行不能为空')
          return
        }
        if (this.ruleForm.SubBranch === '') {
          this.$message.error('请选择支行')
          return
        }
        if (this.ruleForm.reservePhone === '') {
          this.$message.error('预留手机号不能为空')
          return
        }
      }
      // 校验⬆

      if (this.ruleForm.certDate) {
        this.ruleForm.LicenseCerBeginDate = this.ruleForm.certDate.split('-')[0] // 符号前的值
        this.ruleForm.LicenseCerEndDate = this.ruleForm.certDate.split('-')[1] // 符号后的值
      }
      if (this.ruleForm.LicenseDate) {
        this.ruleForm.licenseBeginDate = this.ruleForm.LicenseDate.split('-')[0] // 符号前的值
        this.ruleForm.licenseEndDate = this.ruleForm.LicenseDate.split('-')[1] // 符号后的值
      }
      if (this.ruleForm.settIdNumDate) {
        this.ruleForm.stlCerBeginDate = this.ruleForm.settIdNumDate.split('-')[0] // 符号前的值
        this.ruleForm.stlCerEndDate = this.ruleForm.settIdNumDate.split('-')[1] // 符号后的值
      }

      console.log('ruleform', this.ruleForm)
      if (this.ifModify) {
        this.SubmitChangeInfo()
      } else {
        this.confirmSubmit()
      }
    },
    // 发送提交
    confirmSubmit() {
      // 对结算方式处理新增
      if (this.ruleForm.settType === 'DG') {
        this.finalStlType = '1'
      } else if (this.ruleForm.settType === 'DS') {
        this.finalStlType = '2'
      } else {
        this.finalStlType = '3'
      }
      const data = {
        userType: this.ruleForm.userType,
        stlType: this.finalStlType,
        licensePath: this.ruleForm.BusinessLicenseImgS,
        contactName: this.ruleForm.name,
        contactPhone: this.ruleForm.contactPhone,
        corpName: this.ruleForm.legalName,
        corpCerNo: this.ruleForm.legalPhone,
        cerBeginDate: this.ruleForm.LicenseCerBeginDate,
        cerEndDate: this.ruleForm.LicenseCerEndDate,
        cerFrontPath: this.ruleForm.legalPositiveImgS,
        cerBehindPath: this.ruleForm.legalBackImgS,
        licenseNo: this.ruleForm.LicenseNum,
        licenseBeginDate: this.ruleForm.licenseBeginDate,
        licenseEndDate: this.ruleForm.licenseEndDate,
        licenseProvince: this.ruleForm.provinceCodeZ,
        licenseCity: this.ruleForm.CityCodeZ,
        licenseArea: this.ruleForm.AreasCodeZ,
        licenseAddr: this.ruleForm.DetailedAddress,
        stlAccName: this.ruleForm.Settname,
        stlBankNo: this.ruleForm.SettCardNum,
        stlProvince: this.ruleForm.provinceCode,
        stlCity: this.ruleForm.CityCode,
        stlArea: this.ruleForm.AreasCode,
        stlBankName: this.ruleForm.HeadOfficeName,
        stlBankCode: this.ruleForm.HeadOffice,
        stlSubBankName: this.ruleForm.SubBranchName,
        stlSubBankCode: this.ruleForm.SubBranch,
        stlPhone: this.ruleForm.reservePhone,
        licenseName: this.ruleForm.LicenseName,
        stlCerBeginDate: this.ruleForm.stlCerBeginDate,
        stlCerEndDate: this.ruleForm.stlCerEndDate,
        stlCerNo: this.ruleForm.settIdNum,
        openPermitPath: this.ruleForm.permitImgS,
        stlCerFrontPath: this.ruleForm.settPositiveImgS,
        stlCerBehindPath: this.ruleForm.settBackImgS,
        relationPath: this.ruleForm.proveImgS,
        cardFrontPath: this.ruleForm.BackFrontImgS,
        userAddress: this.ruleForm.DetailedAddress
      }
      console.log('新增最终发送参数+++++++++', data)
      supplementAdd(data).then(res => {
        if (res.succeed) {
          this.$message({
            message: '新增成功!',
            type: 'success'
          })
          setTimeout(() => { // 定义一个定时器,1秒之后再跳转
            this.$router.push({
              name: 'SystemUserSetting'
            })
          }, 1000)
          console.log('修看看发送成功了没改', res)
        } else {
          this.$message({
            message: res.msg,
            type: 'warning'
          })
        }
      })
    },
    // 修改渠道信息
    SubmitChangeInfo() {
      // 对结算方式处理
      if (this.ruleForm.settType === 'DG') {
        this.finalStlType = '1'
      } else if (this.ruleForm.settType === 'DS') {
        this.finalStlType = '2'
      } else {
        this.finalStlType = '3'
      }
      var dataS = {}
      if (this.ruleForm.userType === '1' && this.finalStlType === '1') {
        dataS = {
          userType: this.ruleForm.userType,
          stlType: this.finalStlType,
          licensePath: this.ruleForm.BusinessLicenseImgS,
          contactName: this.ruleForm.name,
          contactPhone: this.ruleForm.contactPhone,
          corpName: this.ruleForm.legalName,
          corpCerNo: this.ruleForm.legalPhone,
          cerBeginDate: this.ruleForm.LicenseCerBeginDate,
          cerEndDate: this.ruleForm.LicenseCerEndDate,
          cerFrontPath: this.ruleForm.legalPositiveImgS,
          cerBehindPath: this.ruleForm.legalBackImgS,
          licenseNo: this.ruleForm.LicenseNum,
          licenseBeginDate: this.ruleForm.licenseBeginDate,
          licenseEndDate: this.ruleForm.licenseEndDate,
          licenseProvince: this.ruleForm.provinceCodeZ,
          licenseCity: this.ruleForm.CityCodeZ,
          licenseArea: this.ruleForm.AreasCodeZ,
          licenseAddr: this.ruleForm.DetailedAddress,
          stlAccName: this.ruleForm.Settname,
          stlBankNo: this.ruleForm.SettCardNum,
          stlProvince: this.ruleForm.provinceCode,
          stlCity: this.ruleForm.CityCode,
          stlArea: this.ruleForm.AreasCode,
          stlBankName: this.ruleForm.HeadOfficeName,
          stlBankCode: this.ruleForm.HeadOffice,
          stlSubBankName: this.ruleForm.SubBranchName,
          stlSubBankCode: this.ruleForm.SubBranch,
          stlPhone: this.ruleForm.reservePhone,
          licenseName: this.ruleForm.LicenseName,
          openPermitPath: this.ruleForm.permitImgS,
          userAddress: this.ruleForm.DetailedAddress
        }
        console.log('修改企业用户对公结算', dataS)
      }

      if (this.ruleForm.userType === '1' && this.finalStlType === '2') {
        dataS = {
          userType: this.ruleForm.userType,
          stlType: this.finalStlType,
          licensePath: this.ruleForm.BusinessLicenseImgS,
          contactName: this.ruleForm.name,
          contactPhone: this.ruleForm.contactPhone,
          corpName: this.ruleForm.legalName,
          corpCerNo: this.ruleForm.legalPhone,
          cerBeginDate: this.ruleForm.LicenseCerBeginDate,
          cerEndDate: this.ruleForm.LicenseCerEndDate,
          cerFrontPath: this.ruleForm.legalPositiveImgS,
          cerBehindPath: this.ruleForm.legalBackImgS,
          licenseNo: this.ruleForm.LicenseNum,
          licenseBeginDate: this.ruleForm.licenseBeginDate,
          licenseEndDate: this.ruleForm.licenseEndDate,
          licenseProvince: this.ruleForm.provinceCodeZ,
          licenseCity: this.ruleForm.CityCodeZ,
          licenseArea: this.ruleForm.AreasCodeZ,
          licenseAddr: this.ruleForm.DetailedAddress,
          stlAccName: this.ruleForm.Settname,
          stlBankNo: this.ruleForm.SettCardNum,
          stlProvince: this.ruleForm.provinceCode,
          stlCity: this.ruleForm.CityCode,
          stlArea: this.ruleForm.AreasCode,
          stlBankName: this.ruleForm.HeadOfficeName,
          stlBankCode: this.ruleForm.HeadOffice,
          stlSubBankName: this.ruleForm.SubBranchName,
          stlSubBankCode: this.ruleForm.SubBranch,
          stlPhone: this.ruleForm.reservePhone,
          licenseName: this.ruleForm.LicenseName,
          cardFrontPath: this.ruleForm.BackFrontImgS,
          userAddress: this.ruleForm.DetailedAddress
        }
        console.log('修改企业用户对私结算', dataS)
      }

      if (this.ruleForm.userType === '1' && this.finalStlType === '3') {
        dataS = {
          userType: this.ruleForm.userType,
          stlType: this.finalStlType,
          licensePath: this.ruleForm.BusinessLicenseImgS,
          contactName: this.ruleForm.name,
          contactPhone: this.ruleForm.contactPhone,
          corpName: this.ruleForm.legalName,
          corpCerNo: this.ruleForm.legalPhone,
          cerBeginDate: this.ruleForm.LicenseCerBeginDate,
          cerEndDate: this.ruleForm.LicenseCerEndDate,
          cerFrontPath: this.ruleForm.legalPositiveImgS,
          cerBehindPath: this.ruleForm.legalBackImgS,
          licenseNo: this.ruleForm.LicenseNum,
          licenseBeginDate: this.ruleForm.licenseBeginDate,
          licenseEndDate: this.ruleForm.licenseEndDate,
          licenseProvince: this.ruleForm.provinceCodeZ,
          licenseCity: this.ruleForm.CityCodeZ,
          licenseArea: this.ruleForm.AreasCodeZ,
          licenseAddr: this.ruleForm.DetailedAddress,
          stlAccName: this.ruleForm.Settname,
          stlBankNo: this.ruleForm.SettCardNum,
          stlProvince: this.ruleForm.provinceCode,
          stlCity: this.ruleForm.CityCode,
          stlArea: this.ruleForm.AreasCode,
          stlBankName: this.ruleForm.HeadOfficeName,
          stlBankCode: this.ruleForm.HeadOffice,
          stlSubBankName: this.ruleForm.SubBranchName,
          stlSubBankCode: this.ruleForm.SubBranch,
          stlPhone: this.ruleForm.reservePhone,
          licenseName: this.ruleForm.LicenseName,
          stlCerBeginDate: this.ruleForm.stlCerBeginDate,
          stlCerEndDate: this.ruleForm.stlCerEndDate,
          stlCerNo: this.ruleForm.settIdNum,
          stlCerFrontPath: this.ruleForm.settPositiveImgS,
          stlCerBehindPath: this.ruleForm.settBackImgS,
          relationPath: this.ruleForm.proveImgS,
          cardFrontPath: this.ruleForm.BackFrontImgS,
          userAddress: this.ruleForm.DetailedAddress
        }
        console.log('修改企业用户非法人对私结算', dataS)
      }

      if (this.ruleForm.userType === '3') {
        dataS = {
          userType: this.ruleForm.userType,
          stlType: this.finalStlType,
          licenseAddr: this.ruleForm.DetailedAddress,
          stlAccName: this.ruleForm.Settname,
          stlBankNo: this.ruleForm.SettCardNum,
          stlProvince: this.ruleForm.provinceCode,
          stlCity: this.ruleForm.CityCode,
          stlArea: this.ruleForm.AreasCode,
          stlBankName: this.ruleForm.HeadOfficeName,
          stlBankCode: this.ruleForm.HeadOffice,
          stlSubBankName: this.ruleForm.SubBranchName,
          stlSubBankCode: this.ruleForm.SubBranch,
          stlPhone: this.ruleForm.reservePhone,
          stlCerBeginDate: this.ruleForm.stlCerBeginDate,
          stlCerEndDate: this.ruleForm.stlCerEndDate,
          stlCerNo: this.ruleForm.settIdNum,
          stlCerFrontPath: this.ruleForm.settPositiveImgS,
          stlCerBehindPath: this.ruleForm.settBackImgS,
          cardFrontPath: this.ruleForm.BackFrontImgS,
          userAddress: this.ruleForm.DetailedAddress
        }
        console.log('修改个人用户法人对私结算', dataS)
      }
      changeInfo(dataS).then(res => {
        if (res.succeed) {
          this.$message({
            message: '修改成功!',
            type: 'success'
          })
          setTimeout(() => { // 定义一个定时器,1秒之后再跳转
            this.$router.push({
              name: 'SystemUserSetting'
            })
          }, 1000)
          console.log('修看看发送成功了没改', res)
        } else {
          this.$message({
            message: res.msg,
            type: 'warning'
          })
        }
      })
    },
    // handleAvatarSuccess(res, file) {
    //   if (res.code === 0) {
    //     this.icon = res.data.baseUrl + res.data.path
    //     this.ruleForm.icon = res.data.path
    //     this.$refs.ruleForm.clearValidate(['icon'])
    //   } else {
    //     this.$message.error(res.msg)
    //   }
    // },

    // 上传前处理
    // beforeAvatarUpload(file) {
    //   return this.$beforeUploadImg(file, this, 1000, 1000, 1)
    // },
    switchUser() {
      console.log('+++++++++++')
    },
    handleAvatarSuccess(res, file) {
      this.imageUrl = URL.createObjectURL(file.raw)
      if (res.code === 0) {
        this.icon = res.data.baseUrl + res.data.path
      }
    },
    delectImageFormat(imageData) {
      let data = imageData
      data = data.replace(/ /g, '')
      data = data.replace('https://hyyxboss.oss-cn-shenzhen.aliyuncs.com/', '')
      // console.log('===================data===================,', data)
      return data
    }
  }
}
</script>
<style scoped="scoped" lang="scss">
  .box {
    padding: 20px 20px;
  }

  /* 上传 */
  .app-uploader-img-plus {
    width: 100px;
    height: 100px;
    border: 1px dotted #ddd;
  }

  .app-uploader-img-plus-icon {
    font-size: 28px;
    color: #8c939d;
    width: 100px;
    height: 100px;
    line-height: 100px;
    text-align: center;
  }

  .avatar {
    width: 100px;
    height: 100px;
    display: block;
  }

  .upload-tips {
    margin: 20px 0 0 20px;

    li {
      margin-top: 10px;
      font-size: 14px;
      line-height: 16px;
      color: #999;
    }
  }
</style>
